<%@ page import="java.util.List" %>
<%@ page import="src.com.workhard.pojo.Student" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/12/2
  Time: 15:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>展示学生的信息</title>
    <style>
        table{
            width: 600px;
            border-collapse: collapse;
            border: 1px solid #000000;
            text-align: center;
        }
        table tr td,th{
            border: 1px solid #000000;
        }
    </style>
</head>
<body>
<%--练习2,jsp输出一个表格,里面有10个学生的信息--%>
<%
    //定义一个数组
    List<Student> studentList = new ArrayList<>();
    //给数组中添加十个学生
    for(int i = 0 ; i < 10 ; i++){
        studentList.add(new Student(i , "name" + i , 1+i , "phone"+i));
    }
%>

<!--将这10个学生使用表格进行输出-->
<h1 align="center">学生信息</h1>
<table align="center">
    <tr>
        <th>ID</th>
        <th>姓名</th>
        <th>年龄</th>
        <th>电话</th>
        <th>操作</th>
    </tr>
    <%for(Student student : studentList){%>
        <tr>
            <td><%=student.getId()%></td>
            <td><%=student.getName()%></td>
            <td><%=student.getAge()%></td>
            <td><%=student.getPhone()%></td>
            <td>修改|删除</td>
        </tr>
    <%}%>
</table>


</body>
</html>
